<?php
/**
 * Copyright 2011  SURFfoundation
 * 
 * This file is part of ESCAPE.
 * 
 * ESCAPE is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * ESCAPE is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with ESCAPE.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * For more information:
 * http://escapesurf.wordpress.com/
 * http://www.surffoundation.nl/
 * 
 * Contact: d.vierkant@utwente.nl
 * 
 * @license http://www.gnu.org/licenses/gpl.html GNU GPLv3
 */
?>
<?php
/**
 * SamlSettings
 * 
 * Wraps around PHP-SAML's SamlSettings class, filling in the settings based on the ESCAPE configuration.
 */
class escape_saml_SamlSettings extends SamlSettings
{
	/**
	 * Construct a SamlSettings object. 
	 * @param array $config ESCAPE configuration
	 */
	public function __construct($config)
	{
		// When using Service Provider Initiated SSO, this URL asks the IdP to authenticate the user.
		$this->idp_sso_target_url= $config['saml']['idp_sso_target_url'];

		// The certificate for the users account in the IdP
		$this->x509certificate = $config['saml']['x509certificate'];

		// The URL where to the SAML Response/SAML Assertion will be posted
		$this->assertion_consumer_service_url = $config['server_url'] . '/processSamlLogin';

		// Name of this application
		$this->issuer = $config['saml']['issuer'];

		// Tells the IdP to return the email address of the current user
		$this->name_identifier_format = $config['saml']['name_identifier_format'];
	}
}